<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>SHOYO</title>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <link rel="stylesheet" href="../static/css/common.css">
    <script src="../static/js/rem.js"></script>
    <link rel="stylesheet" href="../static/css/questions.css">
    <link rel="stylesheet" href="../static/css/animate.css">
</head>
<body>
	<div id="content">
		<div class="topimg"><img src="../static/images/img_06.png" alt=""></div>
		<div class="centercon">
			<div class="bacimg">
				<img src="../static/images/4.gif" alt="">
			</div>
			<div class="ques"></div>
		</div>
<!-- 		<div class="btnagin animated delay-2s zoomIn">
			<img src="../static/images/img_34.png" alt="">
		</div> -->
		<div class="bottomfooter">
			<img src="../static/images/img_31.png" alt="">
		</div>
	</div>
	<script type="text/html" id="renderPage">
		<% for(var i=0;i<content.question.length;i++){ %>
			<p class="nametips  animated  <%= content.texiao%>"><%= content.question[i]%></p>
		<% } %>
		<div class="inpname  animated delay-1s <%= content.texiao%>">
			<ul>
				<% for(var j=0;j<content.choices.length;j++){ %>
					<li>
						<dl>
							<a class="aclick" data-score=<%= content.choices[j].source%> data-hrefid = <%= content.id%> href="#<%= content.id%>">
								<dt><%= content.choices[j].totId%>、</dt>
								<dd><%= content.choices[j].choice%></dd>
							</a>
						</dl>
					</li>
				<% } %>
			</ul>
		</div>
        <img src="" alt="" style="./static/video/1.gif" style="display:none">
        <img src="" alt="" style="./static/video/2.gif" style="display:none">
        <img src="" alt="" style="./static/video/3.gif" style="display:none">
	</script>
	<script src="https://cdn.bootcss.com/zepto/1.0rc1/zepto.min.js"></script>
	<script src="../static/lib/template-native.js"></script>
	<script src="../static/js/data.js"></script>
	<script>
		//获取题目的位置
		//var tiNum = window.location.hash.split('#')[1];
		var	tiObj = {content:data.questions[0]};
		// if(Number(tiNum)>=0&&Number(tiNum)<=11){
		// 	tiObj.content = data.questions[tiNum];
		// }else{
		// 	tiObj.content = data.questions[1];
		// };
		function geturl(name) { //获取页面之间的传值
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = window.location.search.substr(1).match(reg);
			if(r != null) return unescape(r[2]);
			return null;
		};
		var age = Number(geturl("age"));
		var zage = Number(geturl("age"));
		var html = template("renderPage",tiObj);
		document.querySelector(".ques").innerHTML = html;
		var addNum = 2;
		$('.ques').delegate('.aclick','touchstart',function(){
			$(this).find("dt").addClass('addImg');
			if(addNum>=7){
				addNum=3;
			}else{
				addNum++;
			}
			if(this.dataset["hrefid"]<13){
				$(".bacimg img").attr("src","../static/images/"+addNum+".gif");
			};
			age+=Number($(this).data("score"));
		});
		//换题
		$('.ques').delegate('.aclick','touchend',function(){
			var _$this = $(this);
			var _this = this;
			setTimeout(function(){
				_$this.css("background",'none');
				if(_this.dataset["hrefid"]<13){
					tiObj.content = data.questions[_this.dataset["hrefid"]];
					html = template("renderPage",tiObj);
					document.querySelector(".ques").innerHTML = html;
				}else{
					window.location.href="./answer.html?jage="+age+"&zage="+zage
				}
			},300)
		});
	</script>
</body>
</html>